#ifndef WIFI_STATION_H
#define WIFI_STATION_H
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "nvs_flash.h"

#include "lwip/err.h"
#include "lwip/sys.h"
#include "esp_netif.h"
#include "esp_eth.h"
#include "protocol_examples_common.h"
#include <esp_http_server.h>
#define EXAMPLE_ESP_WIFI_SSID      "A304"
#define EXAMPLE_ESP_WIFI_PASS      "304123321"
#define EXAMPLE_ESP_MAXIMUM_RETRY  5 //Station连接AP时重试的次数

/* FreeRTOS event group to signal when we assre connected*/
static EventGroupHandle_t s_wifi_event_group;

/* The event group allows multiple bits for each event, but we only care about two events:
 * - we are connected to the AP with an IP
 * - we failed to connect after the maximum amount of retries */
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT      BIT1
static const char *WIFI_TAG = "wifi station";
static int s_retry_num = 0;
void wifi_init_sta(void);
static void event_handler(void* arg, esp_event_base_t event_base,
                                int32_t event_id, void* event_data);

#endif